<template>
	<view class="container">
		<!--  -->
		<textarea :auto-height="true" :focus="true" maxlength="300" v-model="introduce" class="introduce-textarea" placeholder-class="introduce-textarea-placeholder" :placeholder="userInfo.introduce || '请输入个人介绍...'"></textarea>
		<view class="introduce-submit"><u-button @click="saveIntroduce" type="main-theme">保存</u-button></view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			introduce: ''
		};
	},

	onLoad() {
		this.introduce = this.userInfo.introduce;
	},
	methods: {
		saveIntroduce() {
			if (this.$u.test.isEmpty(this.introduce)) {
				this.$u.toast('个人介绍不可为空');
				return false;
			}
			this.$u.api.saveUserBasic({ introduce: this.introduce }).then(() => {
				this.refreshUserInfo();
				this.navigateBack()
			});
		}
	}
};
</script>

<style lang="scss">
.introduce-textarea {
	width: 750rpx;
	box-sizing: border-box;
	background-color: #fff;
	padding: 20rpx 30rpx;
	min-height: 300rpx;
	font-size: 30rpx;
}
.introduce-textarea-placeholder {
	font-size: 30rpx;
}
.introduce-submit {
	margin-top: 60rpx;
	padding: 0 32rpx;
}
</style>
